
//
// 120304 - AH - Created.
//

package org.soekrat.engine.dictionary;


/**
 * <p>
 *   Interface for objects that are dictionaries.
 * </p>
 * @author Arne Halvorsen (AH)
 */
public interface Dictionary 
{
  /**
   * <p>
   *   Gets number of words in dictionary.
   * </p>
   * @return Count.
   */
  int size();
  
  /**
   * <p>
   *   Add word to dictionary.
   * </p>
   * @param w Word to add.
   * @return {@code true} if added word, {@code false} if word already in 
   *         dictionary.
   */
  boolean add(String w);
  
  /**
   * <p>
   *   Removes word from dictionary.
   * </p>
   * @param w Word to remove.
   * @return {@code true} if removed word, {@code false} if word not found in
   *         dictionary.
   */
  boolean remove(String w);
  
  /**
   * <p>
   *   Tells if word is in dictionary.
   * </p>
   * @param w Word to look for.
   * @return {@code true} if is, {@code false} if is not.
   */
  boolean contains(String w);
  
  /**
   * <p>
   *   Gets words in the dictionary that are suffixes to given string. 
   * </p>
   * <p>
   *   A suffix is a string that when appended to the given string gives a
   *   word that the dictionary contains.
   * </p>
   * @param s {@code String} to find suffixes for.
   * @return Suffixes.
   */
  String[] getSuffixes(String s);
  
  /**
   * <p>
   *   Gets all words in the dictionary.
   * </p>
   * @return Words in dictionary.
   */
  String[] getWords();
  
}
